import time

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

d = webdriver.Chrome(service=Service('chromedriver.exe'))
d.get('http://www.baidu.com')
d.maximize_window()
# 浏览器截图
d.get_screenshot_as_file('1.png')
time.sleep(2)
# 刷新页面
d.refresh()
time.sleep(20)
d.close()